//package com.lyt.springboot.service;
//
//import org.springframework.kafka.annotation.KafkaListener;
//import org.springframework.stereotype.Service;
//
//@Service
//public class KafkaConsumer {
//
//    @KafkaListener(topics = "my-topic", groupId = "my-group")
//    public void consume(String message) {
//        System.out.println("Consumed message: " + message);
//    }
//
//    // 监听带key的消息
//    @KafkaListener(topics = "my-topic", groupId = "my-group")
//    public void consumeWithKey(String key, String message) {
//        System.out.println("Consumed message with key: " + key + ", value: " + message);
//    }
//}